<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<!DOCTYPE html>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
<html lang="en">

    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title></title>

        <link rel="stylesheet" href="<%=path%>/assets/plugins/bootstrap/css/bootstrap.min.css">
        <link rel="stylesheet" href="<%=path%>/assets/fonts/css/font-awesome.min.css">
        <link rel="stylesheet" href="<%=path%>/assets/css/style.css">
        <script src="<%=path%>/assets/js/jquery-1.10.2.min.js"></script>
        <script src="<%=path%>/assets/plugins/bootstrap/js/bootstrap.min.js"></script>
        <script src="<%=path%>/assets/js/jquery.backstretch.min.js"></script>
		<script type="text/javascript">
			var error = '${SPRING_SECURITY_LAST_EXCEPTION.message}';
			$(function(){
				if(error && typeof(error)!='undefined' && error!='')
					alert(error);
			});
			<% session.removeAttribute("SPRING_SECURITY_LAST_EXCEPTION");%>
</script>
    </head>
    <body>
        <div class="top-content">
            <div class="inner-bg">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-8 col-sm-offset-2 text">
                            <h1><strong>欢迎登陆车辆检查联动系统</strong> </h1>
                            
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6 col-sm-offset-3 form-box">
                        	<div class="form-top">
                        		<div class="form-top-left">
                            		<p>输入您的用户名和密码以登录</p>
                        		</div>
                        		<div class="form-top-right">
                        			<i class="fa fa-key"></i>
                        		</div>
                            </div>
                            <div class="form-bottom">
			                    <form role="form" action="<%=path %>/j_spring_security_check" method="post" class="login-form">
			                    	<div class="form-group">
<!-- 			                    		<label class="sr-only" for="form-username">Username</label> -->
			                        	<input type="text" name="username" placeholder="用户名" class="form-username form-control" id="loginName">
			                        </div>
			                        <div class="form-group">
<!-- 			                        	<label class="sr-only" for="form-password">Password</label> -->
			                        	<input type="password" name="password" placeholder="密码" class="form-password form-control" id="password">
			                        </div>
<!-- 			                        <div class="form-group"> -->
<!-- 			                        	<div id="msg" class="alert alert-danger" role="alert" style="display: none"></div> -->
<!-- 			                        </div> -->
			                        <button type="submit" class="btn btn-primary btn-block">登录</button>
			                    </form>
		                    </div>
                        </div>
                    </div>
                </div>
            </div>
            
        </div>



    </body>
	<script type="text/javascript">
		$(function(){
			$.backstretch("<%=basePath%>/assets/img/backgrounds/1.jpg");
		    $('.login-form input[type="text"], .login-form input[type="password"], .login-form textarea').on('focus', function() {
		    	$(this).removeClass('input-error');
		    });
		    
		    $('.login-form').on('submit', function(e) {
		    	$(this).find('input[type="text"], input[type="password"], textarea').each(function(){
		    		if( $(this).val() == "" ) {
		    			e.preventDefault();
		    			$(this).addClass('input-error');
		    		}
		    		else {
		    			$(this).removeClass('input-error');
		    		}
		    	});
		    	
		    });
		    
		})
// 		function check(){
// 	    	if($("#loginName").val() == ""){
// 	    		$("#msg").show();
// 	    		$("#msg").html("用户名不能为空");
// 	    		return false;
// 	    	}
// 	    	if($("#password").val() == ""){
// 	    		$("#msg").show();
// 	    		$("#msg").html("密码不能为空");
// 	    		return false;
// 	    	}
// 	    	$("#msg").hide();
// 	    }
	</script>
</html>